<template>
  <transition name="vertical-fade" >
    <div class="search-title border-bottom" v-show="showSearchTitle">
      <div class="text">什么值得买</div>
      <!--
      <div class="search">
        <i class="iconfont icon-search"></i>
      </div>
      -->
      <div class="search-box-wrapper">
        <search-box @ifocus="ifocus"></search-box>
      </div>
      <div class="fenlei">
        <router-link tag="a" @click.prevent to="/fenleimenu" >
          <div class="fenlei-wrapper">
            <span class="bgicon z-icon-all-tabs"></span>
            <span>分类</span>
          </div>
        </router-link>
      </div>
      <!--
      <div class="filter">
        <i class="iconfont icon-filter"></i>
      </div>
      <div class="add">
        <i class="iconfont icon-add"></i>
      </div>
      -->
    </div>
  </transition>
</template>

<script type="text/ecmascript-6">
import { searchTitleMixin } from 'common/js/mixin'
import SearchBox from 'base/search-box/search-box'

export default {
  name: 'search-title',
  mixins: [ searchTitleMixin ],
  components: {
    SearchBox
  },
  data () {
    return {
      showFlag: true
    }
  },
  methods: {
    show () {
      this.showFlag = true
    },
    hide () {
      this.showFlag = false
    },
    ifocus (e) {
      this.$emit('ifocus', e)
    }
  },
  mounted () {
    // clearInterval(this.timer)
    // this.timer = setInterval(() => {
    //   console.log(this.showSearchTitle)
    //   this.setShowSearchTitle(!this.showSearchTitle)
    // }, 5000)
  }
}
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>
.search-title
  display: flex
  align-items: center
  padding: 0px 0px 0px 10px
  background: #FAFAFA
  z-index: 3
  .text
    line-height: 40px
    font-weight: 800
    font-size: 16px
    flex: 0 0 90px
  .search-box-wrapper
    flex: 1
    // background: green
    // padding: 0px 15px
  .fenlei
    text-align: center
    flex: 0 0 56px
    width: 56px
    padding-left: 6px
    a
      .fenlei-wrapper
        padding-right: 6px
        span
          display inline-block
          vertical-align: middle
          font-size: 12px
          line-height: 40px
        .bgicon
          height: 16px
          width: 16px
    a:active
      .fenlei-wrapper
        background: rgba(97, 192, 216, .2)

  .filter, .add
    text-align: center
    flex: 0 0 20px
    width: 20px
    font-size: 16px
    line-height: 40px
    margin-left: 8px
.vertical-fade-enter-active, .vertical-fade-leave-active
  transition: transform .3s
.vertical-fade-enter, .vertical-fade-leave-to
  transform: translate3d(0, -100%, 0)
</style>
